package com.zsc.wxapp.controller.admin;

import com.zsc.wxapp.entity.vo.RuntimeDataVO;
import com.zsc.wxapp.result.Result;
import com.zsc.wxapp.services.StatisticsDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController("adminStatisticalDataController")
@RequestMapping("/api/wxapp/admin/StatisticalData")
//@Api(tags = "统计数据相关接口")
@Slf4j
public class StatisticalDataController {

    @Resource
    private StatisticsDataService statisticsDataService;

    /**
     * 获取当天数据
     */
    @GetMapping("/getTodayData")
//    @ApiOperation("获取当天运行数据")
    public Result<RuntimeDataVO> getTodayData() {
        return Result.success(statisticsDataService.getRuntimeData());
    }

    /**
     * 按时间类型获取用户上传数据 1是天，2是月，3是季度
     * @param type 时间类型
     */
    @GetMapping("/getRecentData")
//    @ApiOperation("按时间获取运行数据")
//    @ApiImplicitParam(name = "type", value = "时间类型", required = true)
    public Result<RuntimeDataVO> getRunTimeDataByTime(Integer type) {
        return Result.success(statisticsDataService.getRunTimeDataByTime(type));
    }

    /**
     * 按地区获取用户上传数据
     */
    @GetMapping("/getRuntimeDataByArea")
//    @ApiOperation("按地区获取运行数据")
    public Result<RuntimeDataVO> getRuntimeDataByArea() {
        return Result.success(statisticsDataService.getRuntimeDataByArea());
    }

    /**
     * 按用户类型获取用户上传数据 1是按照挡位分类，2是按业态分类，3是按终端类型分类
     */
    @GetMapping("/getRuntimeDataByCustType")
//    @ApiOperation("按用户类型获取运行数据")
//    @ApiImplicitParam(name = "type", value = "分类类型", required = true)
    public Result<RuntimeDataVO> getRuntimeDataByCustType(Integer type) {
        return Result.success(statisticsDataService.getRuntimeDataByCustType(type));
    }
}
